import { lazy } from 'react';
import { RouteObject, Navigate } from 'react-router-dom';
import MainLayout from '../components/MainLayout';
import TechInsight from '../pages/tech-insight';
import GraphBuilder from '../pages/graph-builder';
import GraphView from '../pages/graph-builder/GraphView';

const Home = lazy(() => import('../pages/Home'));
const AIChat = lazy(() => import('../pages/AIChat'));
const Report = lazy(() => import('../pages/Report'));
const ReportDetail = lazy(() => import('../pages/Report/ReportDetail'));
const ReportEdit = lazy(() => import('../pages/Report/ReportEdit'));
const Login = lazy(() => import('../pages/Login'));
const IndustryReport = lazy(() => import('../pages/Report/IndustryReport'));
const PhaseSummary = lazy(() => import('../pages/Report/PhaseSummary'));
const TrendAnalysis = lazy(() => import('../pages/Trend'));
const Profile = lazy(() => import('../pages/Profile'));
const Knowledge = lazy(() => import('../pages/Knowledge'));
const LocalKnowledge = lazy(() => import('../pages/Knowledge/LocalKnowledge'));
const Important = lazy(() => import('../pages/Knowledge/Important'));
const News = lazy(() => import('../pages/Knowledge/News'));
const NewsDetail = lazy(() => import('../pages/Knowledge/News/detail'));
const PageManage = lazy(() => import('../pages/page-manage'));
const Register = lazy(() => import('../pages/Login/Register'));
const ForgotPassword = lazy(() => import('../pages/Login/ForgotPassword'));

export const routes: RouteObject[] = [
  {
    path: '/login',
    element: <Login />
  },
  {
    path: '/register',
    element: <Register />
  },
  {
    path: '/forgot-password',
    element: <ForgotPassword />
  },
  {
    path: '/',
    element: <Navigate to="/chat" replace />
  },
  {
    path: '/home',
    element: <Home />
  },
  {
    path: '/chat',
    element: <AIChat />
  },
  {
    path: '/report',
    element: <Report />
  },
  {
    path: '/report/detail/:id',
    element: <ReportDetail />
  },
  {
    path: '/report/edit/:id',
    element: <ReportEdit />
  },
  {
    path: '/report/create',
    element: <ReportEdit />
  },
  {
    path: '/report/industry',
    element: <IndustryReport />
  },
  {
    path: '/report/phase-summary',
    element: <PhaseSummary />
  },
  {
    path: '/trend',
    element: <TrendAnalysis />
  },
  {
    path: '/profile',
    element: <Profile />
  },
  {
    path: '/knowledge',
    element: <Knowledge />
  },
  {
    path: '/knowledge/search',
    element: <Knowledge />
  },
  {
    path: '/knowledge/manage',
    element: <LocalKnowledge />
  },
  {
    path: '/knowledge/important',
    element: <Important />
  },
  {
    path: '/knowledge/news',
    element: <News />
  },
  {
    path: '/knowledge/news/:id',
    element: <NewsDetail />
  },
  {
    path: '/tech-insight',
    element: <TechInsight />
  },
  {
    path: '/page-manage',
    element: <PageManage />
  },
  {
    path: '/graph-builder',
    element: <MainLayout><GraphBuilder /></MainLayout>
  },
  {
    path: '/graph-builder/view/:id',
    element: <MainLayout><GraphView /></MainLayout>
  },
];